package com.UU.J2EE.PizzaStore.dao;

import java.sql.ResultSet;

import com.UU.J2EE.PizzaStore.beans.CustomerBean;
import com.UU.J2EE.PizzaStore.beans.MaterialBean;

public class MaterialDao {
	public boolean getMaterial(MaterialBean materialBean) {
        ResultSet rs=null;
        boolean hasOrNot = false;
 
        try{ 
            String sql;
            sql ="SELECT * from  materia where idmateria = " +
                     "'" + materialBean.getId() + "'";
            rs= DBUtil.executeQuery(sql,null);

	    // analyze the result set
	    
	    hasOrNot = rs.next();
	    if(hasOrNot)
	    {
	    	materialBean.setName(rs.getString("name"));
	    	materialBean.setNumber(rs.getInt("number"));
	    }
	}   
	catch(Exception sqle){
            sqle.printStackTrace();
	}
        finally{
        	DBUtil.close(rs, DBUtil.getPs(), DBUtil.getCt());
        }
        return hasOrNot;
  }
}
